home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 529 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: kanze@gabi.gabi-soft.fr (J. Kanze)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Initializer w/sizeof() on lhs term, okay or not?
  5. Date: 16 Feb 1996 09:19:05 PST
  6. Organization: GABI Software, Sarl.
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <KANZE.96Feb16162731@gabi.gabi-soft.fr>
  9. References: <4fqq6l$qcr@venus.roc.csci.csc.com>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 16 Feb 1996 15:27:31 GMT
  12. In-Reply-To: tottinge@csci.csc.com's message of 14 Feb 96 18:35:58 GMT
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMSS9BUy4NqrwXLNJAQGbwgIAu8gU8jbWTndadKp5z0fyMEIOE1FqsiO9
  15.     ZummP6pEcjtNw+JS9xit8ajQ0YcGseWVpY94i9Y+457O+54pYEjmfA==
  16.     =df+Y
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. In article <4fqq6l$qcr@venus.roc.csci.csc.com> tottinge@csci.csc.com
  20. (Tim Ottinger) writes:
  21.  
  22. > It all comes down to a problem where a sizeof() is used on the rhs of an 
  23. > initialization, and it's operating on the object it's initializing:
  24. >     someType z  = fred + sizeof(z);
  25. >                  ^                  ^^
  26.  
  27. This is perfectly legal.  The object z is deamed to be known as soon as
  28. the compiler encounters the `=' sign.
  29.  
  30. > Of course, I've changed the inherited code to read:
  31. >     someType z  = fred + sizeof(someType);
  32. > and all is well.
  33. > So, is the compiler right on this one, that it's certainly disallowed, or is 
  34. > it merely eccentric?
  35.  
  36. Not even eccentric, really, and certainly legal.
  37. -- 
  38. James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
  39. GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
  40. Conseils, itudes et rialisations en logiciel orienti objet --
  41.               -- A la recherche d'une activiti dans une region francophone
  42. ---
  43. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  44.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  45.   in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  46.